using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;

namespace Win32SDK
{
    public sealed class Ole32
    {
        public const string Dll = "Ole32.Dll";
        private Ole32()
        {
        }


        [DllImport(Ole32.Dll)]
        public static extern int WriteClassStm(IStream pStream, ref Guid clsid);

        [DllImport(Ole32.Dll, PreserveSig = false)]
        public static extern IStorage StgCreateDocfileOnILockBytes(ILockBytes iLockBytes, int grfMode, int reserved);
        [DllImport(Ole32.Dll, PreserveSig = false)]
        public static extern IStorage StgOpenStorageOnILockBytes(ILockBytes iLockBytes, IStorage pStgPriority, int grfMode, int sndExcluded, int reserved);
        [DllImport(Ole32.Dll, CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int RevokeDragDrop(HandleRef hwnd);
        [DllImport(Ole32.Dll)]
        public static extern int ReadClassStg(HandleRef pStg, [In, Out] ref Guid pclsid);
        [DllImport(Ole32.Dll)]
        public static extern int ReadClassStg(IStorage pStorage, out Guid clsid);
        [DllImport(Ole32.Dll)]
        public static extern int ReadClassStm(IStream pStream, out Guid clsid);
        [DllImport(Ole32.Dll, CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int RegisterDragDrop(HandleRef hwnd, IOleDropTarget target);
        [DllImport(Ole32.Dll)]
        public static extern int OleLoadFromStream(IStream pStorage, ref Guid iid, out IOleObject pObject);
        [DllImport(Ole32.Dll)]
        public static extern int OleSaveToStream(IPersistStream pPersistStream, IStream pStream);
        [DllImport(Ole32.Dll, CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int OleSetClipboard(IDataObject pDataObj);
        [DllImport(Ole32.Dll, CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
        public static extern int OleUninitialize();
        [DllImport(Ole32.Dll, CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int OleFlushClipboard();
        [DllImport(Ole32.Dll, CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int OleGetClipboard(ref IDataObject data);
        public static int OleInitialize()
        {
            return IntOleInitialize(0);
        }
        [DllImport(Ole32.Dll, EntryPoint = "OleInitialize", SetLastError = true, ExactSpelling = true)]
        private static extern int IntOleInitialize(int val);
        [DllImport(Ole32.Dll, PreserveSig = false)]
        public static extern ILockBytes CreateILockBytesOnHGlobal(HandleRef hGlobal, bool fDeleteOnRelease);

        [return: MarshalAs(UnmanagedType.Interface)]
        [DllImport(Ole32.Dll, ExactSpelling = true, PreserveSig = false)]
        public static extern object CoCreateInstance([In] ref Guid clsid, [MarshalAs(UnmanagedType.Interface)] object punkOuter, int context, [In] ref Guid iid);
        [DllImport(Ole32.Dll, ExactSpelling = true, PreserveSig = false)]
        public static extern IClassFactory2 CoGetClassObject([In] ref Guid clsid, int dwContext, int serverInfo, [In] ref Guid refiid);
        [DllImport(Ole32.Dll)]
        public static extern int CoGetMalloc(int dwReserved, out IMalloc pMalloc);
        [DllImport(Ole32.Dll, ExactSpelling = true)]
        public static extern int CoRegisterMessageFilter(HandleRef newFilter, ref IntPtr oldMsgFilter);
       





    }
}
